package iedcyt.acute.controller.listeners.signComparison;

import iedcyt.acute.model.SignComparisonModel;
import iedcyt.acute.view.SignComparisionView;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

public class Sign2CorpsCheckListener implements Listener {

	private SignComparisonModel _model;
	private SignComparisionView _view;
	
	public Sign2CorpsCheckListener(SignComparisionView view, SignComparisonModel model) {
		this._model = model;
		this._view = view;
	}
	
	public void handleEvent(Event event) {

		_model.setForceDocCorpsAndCentersInSign2(_view.getShowSign2DocCorpAndCenter());
		
		updateView();
	}

	private void updateView() {
		_view.loadCorps2(_model.getSign2Corps(), _model.isSign2CorpsWarning());
		_view.loadCenters2(_model.getSign2Centers(), _model.isSign2CentersWarning());
		_view.compareTables();
	}

}
